package thisgame.model;

import java.util.Collection;
import java.util.Iterator;

/**
 * 캐릭터들을 관리하는 클래스.
 * 
 * @author Kroisse
 *
 */
public class CharacterGroup implements Collidable {

	/**
	 *
	 */
	private Collection<Character> characters = null;

	/**
	 * Ensures that this collection contains the specified element (optional
	 * operation).
	 * 
	 * @param character
	 *            whose presence in this collection is to be ensured.
	 * @see java.util.Collection#add(Object)
	 * 
	 */
	public boolean addCharacter(Character character) {
		return this.characters.add(character);
	}

	/**
	 * Returns an iterator over the elements in this collection.
	 * 
	 * @return an <tt>Iterator</tt> over the elements in this collection
	 * @see java.util.Collection#iterator()
	 * 
	 */
	public Iterator<Character> characterIterator() {
		return characters.iterator();
	}

	/**
	 * Returns the number of elements in this collection.
	 * 
	 * @return the number of elements in this collection
	 * @see java.util.Collection#size()
	 * 
	 */
	public int characterSize() {
		return characters.size();
	}

	/**
	 * Returns all elements of this collection in an array.
	 * 
	 * @return an array containing all of the elements in this collection
	 * @see java.util.Collection#toArray()
	 * 
	 */
	public Character[] characterToArray() {
		return characters.toArray(new Character[characters.size()]);
	}

	/**
	 * Removes all of the elements from this collection (optional operation).
	 * 
	 * @see java.util.Collection#clear()
	 * 
	 */
	public void clearCharacter() {
		this.characters.clear();
	}

	/**
	 * Returns <tt>true</tt> if this collection contains all of the elements in
	 * the specified collection.
	 * 
	 * @param character
	 *            collection to be checked for containment in this collection.
	 * @see java.util.Collection#containsAll(Collection)
	 * 
	 */
	public boolean containsAllCharacter(Collection<Character> character) {
		return this.characters.containsAll(character);
	}

	/**
	 * Returns <tt>true</tt> if this collection contains the specified element.
	 * 
	 * @param character
	 *            whose presence in this collection is to be tested.
	 * @see java.util.Collection#contains(Object)
	 * 
	 */
	public boolean containsCharacter(Character character) {
		return this.characters.contains(character);
	}


	/**
	 * Returns <tt>true</tt> if this collection contains no elements.
	 * 
	 * @return <tt>true</tt> if this collection contains no elements
	 * @see java.util.Collection#isEmpty()
	 * 
	 */
	public boolean isCharacterEmpty() {
		return characters.isEmpty();
	}

	public boolean isCollidedWith(Collection<Position> positions) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isCollidedWith(Position position) {
		// TODO Auto-generated method stub
		return false;
	}

	/**
	 * Removes a single instance of the specified element from this collection,
	 * if it is present (optional operation).
	 * 
	 * @param character
	 *            to be removed from this collection, if present.
	 * @see java.util.Collection#add(Object)
	 * 
	 */
	public boolean removeCharacter(Character character) {
		return this.characters.remove(character);
	}

}
